package client;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Server1 {
public static void serversend(String t) throws IOException{
		
		Socket client1 = null;
		OutputStream out1 = null;
		DataOutputStream dos1 = null;
		InputStream in1 = null;
		DataInputStream dis1 = null;
		try {
			
			client1 =  new Socket("127.0.0.1", 8080);
			out1 = client1.getOutputStream();
			dos1 = new DataOutputStream(out1);
			
			
			
			in1 = client1.getInputStream();
			dis1 = new DataInputStream(in1);
			while( true ){
				
				dos1.writeUTF( t);
			
				
				
			}
			
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				dis1.close();
				in1.close();
				
				dos1.close();
				out1.close();
				client1.close();
				dos1.flush();
				out1.flush();
			
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
	}
}
